<extend name="Public:form_layout" />
<block name="title"><title>添加类型</title></block>
<block name="subheader">
    <script type="text/javascript">
        $(function(){
            $.formValidator.initConfig({formid:"myform",autotip:true,onerror:function(msg,obj){window.top.art.dialog({content:msg,lock:true,width:'200',height:'50'}, function(){this.close();$(obj).focus();})}});
            $("#model_name").formValidator({onshow:"请输入分类名称",onfocus:"请输入模型名称"}).inputValidator({min:1,onerror:"请输入模型名称"}).ajaxValidator({type : "get",url : "__CONTROLLER__/public_check_name?field=name",data :"",datatype : "html",async:'false',success : function(data){  if( data=="1" ){return true;}else{return false;}},buttons: $("#dosubmit"),onerror : "名称已存在。",onwait : "正在连接，请稍候。"});
            $("#tablename").formValidator({onshow:"请输入分类名称",onfocus:"请输入表名"}).inputValidator({min:1,onerror:"请输入表名"}).ajaxValidator({type : "get",url : "__CONTROLLER__/public_check_name?field=tablename",data :"",datatype : "html",async:'false',success : function(data){  if( data == "1" ){return true;}else{return false;}},buttons: $("#dosubmit"),onerror : "名称已存在。",onwait : "正在连接，请稍候。"});
            $("#controller").formValidator({onshow:"请输入控制器名称",onfocus:"请输入控制器名称"}).inputValidator({min:1,onerror:"控制器不能为空"});
        });
</script>
</block>
<block name="subnav">
    <a class="add fb" href="__CONTROLLER__/add"><em>添加模型</em></a>　    <a href="__CONTROLLER__/index" class="on"><em>模型管理</em></a>
</block>
<block name="main">
    <form action="__CONTROLLER__/add" method="post" name="myform" id="myform">
        <table cellpadding="2" cellspacing="1" class="table_form" width="100%">
            <tbody>
                <tr>
                    <th width="100">模型名称：</th>
                    <td><input type="text" name="model[name]" id="model_name" size="30" class="input-text"></td>
                </tr>
                <tr>
                    <th width="100"><font class="red">*</font> 所属类型  </th>
                    <td>
                        <select name="model[typeid]" id="typeid">
                            <?php foreach ($types as $key => $value) {
                                echo "<option value='".$key."'>".$value."</option>";
                            }?>
                        </select>
                    </td>
                </tr>
                <tr>
                    <th width="100">模型表键名：</th>
                    <td><input type="text" name="model[tablename]" id="tablename" size="30" class="input-text"></td>
                </tr>
                <tr>
                    <th>描述：</th>
                    <td><textarea name="model[description]" id="description" cols="50" rows="6"></textarea></td>
                </tr>
                <tr>
                    <th></th>
                    <td><input type="hidden" name="forward" value="__CONTROLLER__/index"> <input type="submit" name="dosubmit" id="dosubmit" class="button" value=" 提交 "></td>
                </tr>
            </tbody>
        </table>
    </form>
</block>